# 滚动到底部
js = "window.scrollTo(0, 10000000);"
remDr$executeScript(js, args = list("dummy"))

js="var q=document.documentElement.scrollTop=10000000"
remDr$executeScript(js, args = list("dummy"))
remDr$screenshot(display = 1)

haoping <- remDr$findElement(using = "css", '.filter-list > li:nth-child(4)')

haoping$getElementAttribute("data-num")

webElem <- remDr$findElement(using = "tag", value = "h2")
test <- remDr$findElement(using = "id", "comment")
test <- remDr$getTitle()
test
test$getElementAttribute(attrName = "data-anchor")


# test source
mypage <- remDr$getPageSource()


page <- read_html(mypage[[1]])
html_nodes(page, ".filter-list > li:nth-child(4)") %>% html_text()
html_nodes(page, "comment")

mynode <- html_nodes(page, ".filter-list > li:nth-child(4)") 
mynode
rvest::html_attr(mynode, "data-num")


jdpage = rdom::rdom("https://item.jd.com/1640917.html")
html_nodes(jdpage)

startServer()
remDr <- remoteDriver$new()
remDr$open()
remDr$navigate("http://www.google.com")
remDr$navigate("http://www.bbc.co.uk")
remDr$goBack()
remDr$goForward()
remDr$quit()





webpage <- read_html(url) 

webpage.new <-  gsub(pattern = "<meta.*?>|<link.*?>|<img.*?>|<a.*?>|</a>|\r\n|<script.*?</script>|<style.*?</style>",
                     "",x = webpage)

webpage.new <- read_html(webpage.new)

html_nodes(webpage.new, ".p-price .price")

hg_tlmgr_install_win("xCJK2uni.sty")






